<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">




    <div class="form-group">
        <label for="c-site_id" class="control-label col-xs-12 col-sm-2">{:__('Category')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-category" data-rule="required"  data-source="prize/selectpage"    class="form-control selectpage" name="row[category]" type="text" value="{$row.category}" onblur="likai(this);">
        </div>
    </div>

    <div class="form-group">
        <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('State')}:</label>
        <div class="col-xs-12 col-sm-8">
            {foreach name="typeList" item="vo"}
            <label for="row[type]-{$key}"><input id="row[state]-{$key}" name="row[type]" type="radio" value="{$key}" {in name="key" value="$row.type"}checked{/in} /> {$vo}</label>
            {/foreach}
        </div>
    </div>
    <div class="form-group">
        <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-percent" class="control-label col-xs-12 col-sm-2">{:__('Percent')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-percent" class="form-control" name="row[percent]" type="number" value="{$row.percent}"  oninput="likai();" onporpertychange="likai();">
        </div>
        <p id="shengyu" style="color:red;"></p>
    </div>

    <div class="form-group">
        <label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-money" class="form-control" name="row[money]" type="number" value="{$row.money}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-interest" class="control-label col-xs-12 col-sm-2">{:__('Interest')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-interest" data-rule="required" class="form-control" step="" name="row[interest]" type="number" value="{$row.interest}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Img')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline">
                <input id="c-image" class="form-control" size="50" name="row[img]" type="text" value="{$row.img}">
                <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-url="{:url('ajax/upload',array('from'=>'przies'))}" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                <ul class="row list-inline plupload-preview" id="p-image"></ul>
            </div>
        </div>
    </div>



    <div class="form-group">
        <label for="c-min_amount" class="control-label col-xs-12 col-sm-2">{:__('Min_amount')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-min_amount" class="form-control" name="row[min_amount]" type="number" value="{$row.min_amount}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-starttime" class="control-label col-xs-12 col-sm-2">{:__('Starttime')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-starttime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[starttime]" type="text" value="{$row.starttime|datetime}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-endtime" class="control-label col-xs-12 col-sm-2">{:__('Endtime')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-endtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[endtime]" type="text" value="{$row.endtime|datetime}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-order" class="control-label col-xs-12 col-sm-2">{:__('Order')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-order" class="form-control" name="row[order]" type="number" value="{$row.order}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-status" class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-status" data-rule="required" class="form-control" name="row[status]" type="text" value="{$row.status}">
        </div>
    </div>



    <div class="form-group">
        <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Describe')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" class="form-control summernote" rows="5" name="row[describe]" cols="50">{$row.describe}</textarea>
        </div>
    </div>

    <div class="form-group">
        <label for="c-status" class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            <label for="status-1"><input id="status-1" name="row[status]" type="radio" value="1"  {if($row['status']==1)} checked="checked" {/if} /> 有效</label>
            <label for="status-0"><input id="status-0" name="row[status]" type="radio" value="0"  {if($row['status']==0)} checked="checked" {/if} /> 失效</label>
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script type="text/javascript">

    function likai(e){
        var cate = $('#c-category').val();
        var per = $('#c-percent').val();
        var id = "{$row['id']}";
         $.post('{:url("prizesetting/tongji")}',
                {cate: cate,per:per,id:id},
                function (data) {
                    console.log(data);
                    if(data.code==1){
                        $('#shengyu').html("剩余中奖比例"+data.num+"%");
                    }
                });
    }

</script>
